/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pkg_entidades;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Oswaldo
 */
@Entity
@Table(name = "spre_preguntas", catalog = "sisventas_db", schema = "public")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Preguntas.findAll", query = "SELECT p FROM Preguntas p"),
    @NamedQuery(name = "Preguntas.findByPreCodigo", query = "SELECT p FROM Preguntas p WHERE p.preCodigo = :preCodigo"),
    @NamedQuery(name = "Preguntas.findByPrePregunta", query = "SELECT p FROM Preguntas p WHERE p.prePregunta = :prePregunta"),
    @NamedQuery(name = "Preguntas.findByPreFecha", query = "SELECT p FROM Preguntas p WHERE p.preFecha = :preFecha")})
public class Preguntas implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "pre_codigo")
    private Integer preCodigo;
    @Size(max = 150)
    @Column(name = "pre_pregunta")
    private String prePregunta;
    @Column(name = "pre_fecha")
    @Temporal(TemporalType.DATE)
    private Date preFecha;
    @JoinColumn(name = "usr_codigo", referencedColumnName = "usr_codigo")
    @ManyToOne
    private Usuario usrCodigo;
    @JoinColumn(name = "aos_codigo", referencedColumnName = "aos_codigo")
    @ManyToOne
    private Artiserv aosCodigo;

    public Preguntas() {
    }

    public Preguntas(Integer preCodigo) {
        this.preCodigo = preCodigo;
    }

    public Integer getPreCodigo() {
        return preCodigo;
    }

    public void setPreCodigo(Integer preCodigo) {
        this.preCodigo = preCodigo;
    }

    public String getPrePregunta() {
        return prePregunta;
    }

    public void setPrePregunta(String prePregunta) {
        this.prePregunta = prePregunta;
    }

    public Date getPreFecha() {
        return preFecha;
    }

    public void setPreFecha(Date preFecha) {
        this.preFecha = preFecha;
    }

    public Usuario getUsrCodigo() {
        return usrCodigo;
    }

    public void setUsrCodigo(Usuario usrCodigo) {
        this.usrCodigo = usrCodigo;
    }

    public Artiserv getAosCodigo() {
        return aosCodigo;
    }

    public void setAosCodigo(Artiserv aosCodigo) {
        this.aosCodigo = aosCodigo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (preCodigo != null ? preCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Preguntas)) {
            return false;
        }
        Preguntas other = (Preguntas) object;
        if ((this.preCodigo == null && other.preCodigo != null) || (this.preCodigo != null && !this.preCodigo.equals(other.preCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return prePregunta;
    }
    
}
